perm filename MAPPER.PAL[AL,HE]1 blob sn#308102 filedate 1977-09-30 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 This file gives the definitions for using the Panofsky map. When loaded
C00005 00003	 Here we set up the 4 page tables and various mapping registers. When
C00010 ENDMK
C⊗;
COMMENT ⊗ This file gives the definitions for using the Panofsky map. When loaded
	it also sets up the "standard" mapping configuration for the AL runtime
	system which lives in the zonker. It does NOT turn the map on.⊗


;  Map definitions

;Page tables:  100 words each, one per page
MAPTB0=166000
MAPTB1=166200
MAPTB2=166400
MAPTB3=166600

        ;Page table entries (each one for 2000 bytes)
	MAPWRT==100000	;Page written
	MAPACC==040000	;Page accessed
	MAPWOK==020000	;Write permission
	MAPROK==010000	;Read permission
	MAPUBS==004000	;1 => Unibus address
;	        003777	Physical page number

;Map space table
MAPKI=167020
MAPKD=167030
MAPSI=167022
MAPSD=167032
MAPUI=167026
MAPUD=167036

        ;Map space table entries
        ;       001400          Page table number
        ;       000200          Transparent mode ( 1 => no mapping)
        ;       000176          Max virtual page (*2)

MAPSR0=167000

	;Status register 0 entries
	MAPENB==100000	;Enable mapping
	MAPMPV==040000	;Max page violation
	MAPRPV==020000	;Read violation
	MAPWPV==010000	;Write violation
;	      	    30	;PC mode of the violating instruction
;		    04	;Error was in I space
;		    03	;Mode of the violating reference

MAPSR1=167002		;Virtual address of the bad reference

MAPSR2=167004		;Virtual PC of 1st word of offending instruction

COMMENT ⊗ Here we set up the 4 page tables and various mapping registers. When
	we are done we have the following:

			Virtual address		Physical address	Device

	Page table 0:	      0 -  77 777	      0 -  77 777	core   16K
			100 000 - 157 777	100 000 - 157 777	crock  12K
			160 000 - 177 777	760 000 - 777 777	i/o	4K

	Page table 1:	      0 - 157 777	200 000 - 357 777	zonker 28K
			160 000 - 177 777	760 000 - 777 777	i/o	4K

	Page table 2:   same as page table 1

	Page table 3:   same as page table 0

	Page table 0 is used by the kernel and DDT. The AL runtime system uses
	page tables 1 & 2, 1 for the instruction space and 2 for the data space.
	Page table 3 is currently unused. Eventually page tables 1 & 2 will be
	different when the data and instruction spaces are separated. Then the
	map will look like this:

			Virtual address		Physical address	Device

	Page table 1:	      0 - 177 777	200 000 - 377 777	zonker 32K

	Page table 2:	      0 -  77 777	400 000 - 477 777	zonker 16K
			100 000 - 157 777	600 000 - 657 777	zonker 12K
			160 000 - 177 777	760 000 - 777 777	i/o	4K

	(when the crock memory goes away then the data space will be contiguous) ⊗

temp1 == .	;Save the location counter
temp2 == %OFFSE	;Save the current offset
.OFFSET -600000	;We want to use real physical addresses here.


;Set up Page Table 0
. = MAPTB0
.REPT 70	;Each table has 64 entries - the last 8 of which are I/O space
  .WORD MAPWOK+MAPROK+MAPUBS+.RPCNT
.ENDR
.REPT 10	;I/O space
  .WORD MAPWOK+MAPROK+MAPUBS+370+.RPCNT
.ENDR

;Set up Page Table 1	for AL runtime - uses Zonker
. = MAPTB1
.REPT 70
  .WORD MAPWOK+MAPROK+MAPUBS+100+.RPCNT	;Virtual 0 → Physical 200 000 (Zonker)
.ENDR
.REPT 10	;I/O space
  .WORD MAPWOK+MAPROK+MAPUBS+370+.RPCNT
.ENDR

;Set up Page Table 2	(like table 1 for now)
. = MAPTB2
.REPT 70
  .WORD MAPWOK+MAPROK+MAPUBS+100+.RPCNT	;Virtual 0 → Physical 200 000 (Zonker)
.ENDR
.REPT 10	;I/O space
  .WORD MAPWOK+MAPROK+MAPUBS+370+.RPCNT
.ENDR

;Set up Page Table 3	(like table 0 for now)
. = MAPTB3
.REPT 70
  .WORD MAPWOK+MAPROK+MAPUBS+.RPCNT
.ENDR
.REPT 10	;I/O space
  .WORD MAPWOK+MAPROK+MAPUBS+370+.RPCNT
.ENDR

;Now set up up the Map Space table

		;Kernel uses page table 0, transparent, no page limit
. = MAPKI
376
. = MAPKD
376

		;Supervisor uses page tables 1&2, mapped, no page limit
. = MAPSI	;page table 1 for instruction space
576
. = MAPSD	;page table 2 for data space
1176

		;User uses page tables 1&2, mapped, no page limit
. = MAPUI	;page table 1 for instruction space
576
. = MAPUD	;page table 2 for data space
1176

;If we want to enable mapping (gasp!) here's what we do
;. = MAPSR0
; MAPENB

.OFFSET temp2	;Restore Offset
. = temp1	;Restore Location Counter